package service

import (
	"MessageSendService/app/common/models/accounts"
	"MessageSendService/app/job/internal/db"
	"fmt"
)

type AccountService struct {
}

var accouuntMap map[int64]accounts.SendAccount

func InitAccount() {
	accouuntMap = make(map[int64]accounts.SendAccount)
	//查找数据库获取账号信息 todo 未来会上配置中心统一管理账户信息
	accountList := db.GetAccountAll()
	for _, account := range accountList {
		accouuntMap[account.ID] = account
	}
	fmt.Println("账户信息:", accouuntMap)
}

func GetAccount(id int64) (account accounts.SendAccount, err error) {
	account, ok := accouuntMap[id]
	if !ok {
		err = fmt.Errorf("account not found")
		return
	}
	return
}
